#include<iostream>
using namespace std;

#include<vector>

/*
class Solution {
public:
    void moveZeroes(vector<int>& nums) {
        vector<int> ret;
        int i = 0;
        for (auto e : nums) {
            if (e != 0) {
                ret.push_back(e);
                continue;
            }
            ++i;

        }

        for (int j = 0; j < i; ++j) {
            ret.push_back(0);
        }
        cout << "[";
        for (int k = 0; k < ret.size();++k) {
            cout << ret[k];
            if (k != ret.size() - 1)
                cout << ",";
        }

        cout << "]";
    }
};
*/
class Solution {
public:
    void moveZeroes(vector<int>& nums) {

        for (int i = 0; i < nums.size(); ++i) {
            if (nums[i] == 0) {
                for (int j = i + 1; j < nums.size(); ++j) {
                    if (nums[j] != 0) {
                        int temp = nums[i];
                        nums[i] = nums[j];
                        nums[j] = temp;
                        break;
                    }

                }
            }

        }

        for (auto e : nums)
            cout << e;

    }
};


int main() {
    Solution s;
    vector<int> nums = { 0,1,0,3,12 };
    s.moveZeroes(nums);


	return 0;
}